package com.wei.flow;

import java.io.IOException;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

public class FlowReduce extends Reducer<FlowBean, Text, Text, FlowBean>{

/*	@Override
	protected void reduce(Text text, Iterable<FlowBean> iterable,Context context)
			throws IOException, InterruptedException {
		long downFlow =0;
		long upFlow =0;
		for (FlowBean flowBean : iterable) {
			 downFlow += flowBean.getDownFlow();
			 upFlow += flowBean.getUpFlow();
		}
		FlowBean flowBean=new FlowBean(upFlow, downFlow);
		context.write(text, flowBean);
	}*/
	
	@Override
	protected void reduce(FlowBean flowBean, Iterable<Text> iterable,Context context)
			throws IOException, InterruptedException {
		Text phone = iterable.iterator().next();
		context.write(phone, flowBean);
	}
	

}
